#ifndef DEFINES_H
#define DEFINES_H



#include <QString>


static const int UNDEFINED = -1;


enum ItemCategory
{
    ItemCategory_Undefined = UNDEFINED,

    ItemCategory_FIRST = 0,

    ItemCategory_Root = ItemCategory_FIRST,
    ItemCategory_Group,
    ItemCategory_Item,
    ItemCategory_Reference,

    ItemCategory_LAST = ItemCategory_Reference
};


static const QString CATEGORY_UNDEFINED_NAME = QT_TRANSLATE_NOOP("AbstractItem", "Undefined Category");
static const QString CATEGORY_ROOT_NAME = QT_TRANSLATE_NOOP("AbstractItem", "Root");
static const QString CATEGORY_GROUP_NAME = QT_TRANSLATE_NOOP("AbstractItem", "Group");
static const QString CATEGORY_ITEM_NAME = QT_TRANSLATE_NOOP("AbstractItem", "Item");
static const QString CATEGORY_REFERENCE_NAME = QT_TRANSLATE_NOOP("AbstractItem", "Reference");


static QString categoryToName(const int& category)
{
    switch (category)
    {
    case ItemCategory_Root:         return CATEGORY_ROOT_NAME;
    case ItemCategory_Group:        return CATEGORY_GROUP_NAME;
    case ItemCategory_Item:         return CATEGORY_ITEM_NAME;
    case ItemCategory_Reference:    return CATEGORY_REFERENCE_NAME;
    default:                        return CATEGORY_UNDEFINED_NAME;
    }
}



static int nameToCategory(const QString& category_name)
{
    if (category_name.toLower() == CATEGORY_ROOT_NAME.toLower()) return ItemCategory_Root;
    if (category_name.toLower() == CATEGORY_GROUP_NAME.toLower()) return ItemCategory_Group;
    if (category_name.toLower() == CATEGORY_ITEM_NAME.toLower()) return ItemCategory_Item;
    if (category_name.toLower() == CATEGORY_REFERENCE_NAME.toLower()) return ItemCategory_Reference;

    return ItemCategory_Undefined;
}



#endif // DEFINES_H



